package com.polaris.live.common.mvvm.ext

import java.lang.reflect.ParameterizedType
/**
 * 获取当前类绑定的泛型ViewModel-class
 *
 * @author Created by 半仙 on 2023/7/31/031 15:16
 */
@Suppress("UNCHECKED_CAST")
fun <VM> getVmClazz(obj: Any): VM {
    return (obj.javaClass.genericSuperclass as ParameterizedType).actualTypeArguments[0] as VM
}